<template>
  <div>
    <van-nav-bar title="我的点赞" />

    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="loadMore"
    >
      <!-- 面经列表 -->
      <article-item
        v-for="item in articleList"
        :key="item.id"
        :article="item"
      ></article-item>
    </van-list>
  </div>
</template>

<script>
import { getLikeOrCollecticle } from "../api/article";
export default {
  data() {
    return {
      loading: true,
      finished: false,
      articleList: [],
      current: 1,
    };
  },
  created() {
    this.loadLikeacticle();
  },
  methods: {
    async loadLikeacticle() {
      const res = await getLikeOrCollecticle({
        optType: 1,
        page: this.current,
      });
      // console.log(res);
      if (this.current === 1) {
        this.articleList = res.data.data.rows;
      } else {
        this.articleList = [...this.articleList, ...res.data.data.rows];
      }
      this.finished = this.current >= res.data.data.pageTotal;
      this.loading = false;
    },
    loadMore() {
      this.current++;
      this.loadLikeacticle();
    },
  },
};
</script>

<style>
</style>